package study.designpattern.memento;

import java.util.ArrayList;
import java.util.List;

import study.designpattern.memento.Originator.Memento;
/**
 * caretaker
 * @author huaigang
 *
 */
public class mainMemento {
    public static void main(String[] args) {
        List<Memento> savedStates = new ArrayList<Memento>();
        
        Originator originator = new Originator();
        originator.setState("state1");
        originator.setState("state2");
        savedStates.add( originator.saveToMemento() );
        originator.setState("state3");
        savedStates.add( originator.saveToMemento() );
        originator.setState("state4");
        
        originator.restoreFromMemento(savedStates.get(1));
    }
}
